#!/usr/bin/python
# -*- coding: UTF-8 -*-
import string
import random
x = string.ascii_letters + string.digits
print(x)
#choice()用于从多个元素中随机选择一个
z2 = (random.choice(x))
print(z2)
z = ''.join((random.choice(x) for i in range(1000)))
print(len(z))
print(z)
d = dict()
#遍历字符串，统计频率
for ch in z:
# 已出现次数加1
    d[ch] = d.get(ch, 0) + 1
    print(ch)
#查看统计结果
for k, v in sorted(d.items()):
    print(k, ':', v)